define(['core/boilerplate', 'conf/menu'],
	function(Boilerplate, Configuration) {
		var Menu = function() {

			this.menu_name = null;
			this.mode = null;
			this.conf = null;
			this.parent = null;

			this.init = function(Manager, Menu) {
				this.parent = Manager;
				this.mode = Manager.displayMode === 'CANVAS' ? Manager.displayMode : 'HTML';
				this.menu_name = Menu;
				this.conf = Configuration.menus[this.menu_name] !== undefined ? Configuration.menus[this.menu_name] : null;

				if (this.mode === 'HTML') {
					for (var i = this.conf.screens.length - 1; i >= 0; i--) {
						this.html(this.conf.id, i, this.conf.screens[i]);						
					}
				}
				else if (this.mode === 'CANVAS') {
					this.canvas();
				}
			}

			this.html = function(ID, Step, Screen) {
				var menu = document.createElement('div');
				// Id 
				menu.id = ID+'_'+Step;
				addClass(menu, ID);
				addClass(menu, 'menu_screen');
				// Title
				var title = document.createElement('h1');
				title.innerHTML = Screen.name === undefined ? this.conf.name : Screen.name;
				// Class
				addClass(title, 'title');
				menu.appendChild(title);


				for (var i = 0; i < Screen.buttons.length; i++) {
					var button = document.createElement('div');
					addClass(button, 'btn');
					button.id = Screen.buttons[i].id;
					button.innerHTML = Screen.buttons[i].text;
					menu.appendChild(button);
					// Action
					var action = Screen.buttons[i].action;
					if (isFunction(action))
						button.onclick = action;
					else
						button.onclick = this.parent.functions[action];
					// Data
					if (Screen.buttons[i].data)
						for (x in Screen.buttons[i].data) {
							if (!isFunction(Screen.buttons[i].data[x]))
								button.setAttribute('data-'+x, Screen.buttons[i].data[x]);
						}
				};

				this.parent.container.appendChild(menu);
			}
			
			this.canvas = function() {
			}
		}

		Menu.prototype = {
			name : "Menu",
			update : function() {
				if(Boilerplate.conf.verbose === true) {
					debug(this.menu_name+' Menu is running - Mode '+this.mode);
				}
				// Update Menu objects
			},
			render : function() {
				// Render Menu
			}
		}

		return Menu;
	}
);